package com.no1.zy.rabbitmq.direct;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DirectProducer {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(){
        String msg= "Hello! direct!";
        System.out.println("生产者发消息msg——》"+msg);
        amqpTemplate.convertAndSend("my_direct_x","zs.abc1",msg);
    }
}
